//	---------------------------------------------------------------------------
//	dark-matter-data
//	Copyright (c) 2014 dark-matter-data committers
//	---------------------------------------------------------------------------
//	This program is free software; you can redistribute it and/or modify it
//	under the terms of the GNU Lesser General Public License as published by the
//	Free Software Foundation; either version 3 of the License, or (at your
//	option) any later version.
//	This program is distributed in the hope that it will be useful, but WITHOUT
//	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
//	more details.
//	You should have received a copy of the GNU Lesser General Public License along
//	with this program; if not, see <http://www.gnu.org/licenses/lgpl.html>.
//	---------------------------------------------------------------------------
package org.dmd.wsdl.shared.generated.dmo;

// Generated from: org.dmd.dms.util.GenUtility.formatImports(GenUtility.java:396)
import java.io.Serializable;                                                  // Always required - (GenUtility.java:224)
import java.util.*;                                                           // Always required if we have any MV attributes - (GenUtility.java:221)
import org.dmd.dmc.DmcAttribute;                                              // Named object - (GenUtility.java:376)
import org.dmd.dmc.DmcNamedObjectIF;                                          // Named object - (GenUtility.java:375)
import org.dmd.dmc.DmcOmni;                                                   // Lazy resolution - (GenUtility.java:320)
import org.dmd.dmc.DmcSliceInfo;                                              // Required for object slicing - (GenUtility.java:229)
import org.dmd.dmc.DmcValueException;                                         // Any attributes - (GenUtility.java:241)
import org.dmd.dmc.types.DefinitionName;                                      // Naming attribute type - (GenUtility.java:370)
import org.dmd.dms.generated.dmo.MetaDMSAG;                                   // Required for MODREC constructor - (GenUtility.java:228)
import org.dmd.dms.generated.types.DmcTypeDefinitionNameSV;                   // Required type - (GenUtility.java:328)
import org.dmd.dms.generated.types.DmcTypeModifierMV;                         // Required for MODREC constructor - (GenUtility.java:227)
import org.dmd.wsdl.shared.generated.dmo.WsdlDefinitionDMO;                   // Base class - (GenUtility.java:355)
import org.dmd.wsdl.shared.generated.dmo.WsdlFaultDMO;                        // Type specific set/add - (GenUtility.java:307)
import org.dmd.wsdl.shared.generated.dmo.WsdlOperationDMO;                    // Type specific set/add - (GenUtility.java:307)
import org.dmd.wsdl.shared.generated.types.DmcTypeWsdlFaultREFMV;             // Reference type - (GenUtility.java:300)
import org.dmd.wsdl.shared.generated.types.DmcTypeWsdlOperationREFMV;         // Reference type - (GenUtility.java:300)
import org.dmd.wsdl.shared.generated.types.WsdlFaultREF;                      // Helper class - (GenUtility.java:335)
import org.dmd.wsdl.shared.generated.types.WsdlOperationREF;                  // Helper class - (GenUtility.java:335)

// Generated from: org.dmd.dms.util.DmoFormatter.getClassHeader(DmoFormatter.java:677)
/**
 * A WSDL 2.0 interface defines the abstract interface of a Web service as a
 * set of abstract\n operations, each operation representing a simple
 * interaction between the client and the service.\n Each operation specifies
 * the types of messages that the service can send or receive as part of that
 * operation.
 * <P>
 * Generated from the dmwsdl schema at version unknown
 * <P>
 * This code was auto-generated by the dmogenerator utility and shouldn't be alterred manually!
 * Generated from: org.dmd.dms.util.DmoFormatter.dumpDMO(DmoFormatter.java:133)
 */
@SuppressWarnings("serial")
public class WsdlInterfaceDMO  extends WsdlDefinitionDMO  implements DmcNamedObjectIF, Serializable  {

    public final static String constructionClassName = "WsdlInterface";


    static {
    }

    public WsdlInterfaceDMO() {
        super("WsdlInterface");
    }

    protected WsdlInterfaceDMO(String oc) {
        super(oc);
    }

    @Override
    public WsdlInterfaceDMO getNew(){
        WsdlInterfaceDMO rc = new WsdlInterfaceDMO();
        return(rc);
    }

    @Override
    public WsdlInterfaceDMO getSlice(DmcSliceInfo info){
        WsdlInterfaceDMO rc = new WsdlInterfaceDMO();
        populateSlice(rc,info);
        return(rc);
    }

    public WsdlInterfaceDMO(DmcTypeModifierMV mods) {
        super("WsdlInterface");
        modrec(true);
        setModifier(mods);
    }

    public WsdlInterfaceDMO getModificationRecorder(){
        WsdlInterfaceDMO rc = new WsdlInterfaceDMO();
        rc.setName(getName());
        rc.setModifier(new DmcTypeModifierMV(MetaDMSAG.__modify));
        rc.modrec(true);
        return(rc);
    }

    // org.dmd.dms.util.DmoFormatter.getAccessFunctions(DmoFormatter.java:751)
    public DefinitionName getObjectName(){
        DmcAttribute<?> name = get(MetaDMSAG.__name);
        if (name != null)
            return((DefinitionName)name.getSV());
    
        return(null);
    }

    // org.dmd.dms.util.DmoFormatter.getAccessFunctions(DmoFormatter.java:768)
    public DmcAttribute<?> getObjectNameAttribute(){
        DmcAttribute<?> name = get(MetaDMSAG.__name);
        return(name);
    }

    // org.dmd.dms.util.DmoFormatter.getAccessFunctions(DmoFormatter.java:775)
    public boolean equals(Object obj){
        if (obj instanceof WsdlInterfaceDMO){
            return( getObjectName().equals( ((WsdlInterfaceDMO) obj).getObjectName()) );
        }
        return(false);
    }

    // org.dmd.dms.util.DmoFormatter.getAccessFunctions(DmoFormatter.java:783)
    public int hashCode(){
        DefinitionName objn = getObjectName();
        if (objn == null)
            return(0);
        
        return(objn.hashCode());
    }

    /**
     * @return An Iterator of WsdlFaultDMO objects.
     */
    @SuppressWarnings("unchecked")
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:970)
    public Iterator<WsdlFaultREF> getFaults(){
        DmcTypeWsdlFaultREFMV attr = (DmcTypeWsdlFaultREFMV) get(DmwsdlDMSAG.__faults);
        if (attr == null)
            return( ((List<WsdlFaultREF>) Collections.EMPTY_LIST).iterator() );

        if (DmcOmni.instance().lazyResolution()){
            if (attr.doLazyResolution(this)){
                rem(attr.getAttributeInfo());
                return( ((List<WsdlFaultREF>) Collections.EMPTY_LIST).iterator() );
            }
        }

        return(attr.getMV());
    }

    /**
     * @return An Iterator of WsdlFaultREFs without attempting lazy resolution (if it's turned on).
     */
    @SuppressWarnings("unchecked")
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:990)
    public Iterator<WsdlFaultREF> getFaultsREFs(){
        DmcTypeWsdlFaultREFMV attr = (DmcTypeWsdlFaultREFMV) get(DmwsdlDMSAG.__faults);
        if (attr == null)
            return( ((List<WsdlFaultREF>) Collections.EMPTY_LIST).iterator() );

        return(attr.getMV());
    }

    /**
     * Adds another faults to the specified value.
     * @param value WsdlFault
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1004)
    public DmcAttribute<?> addFaults(WsdlFaultDMO value) {
        DmcAttribute<?> attr = get(DmwsdlDMSAG.__faults);
        if (attr == null)
            attr = new DmcTypeWsdlFaultREFMV(DmwsdlDMSAG.__faults);
        
        try{
            setLastValue(attr.add(value));
            add(DmwsdlDMSAG.__faults,attr);
        }
        catch(DmcValueException ex){
            throw(new IllegalStateException("The type specific add() method shouldn't throw exceptions!",ex));
        }
        return(attr);
    }

    /**
     * Adds another faults value.
     * @param value A value compatible with WsdlFault
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1245)
    public DmcAttribute<?> addFaults(Object value) throws DmcValueException {
        DmcAttribute<?> attr = get(DmwsdlDMSAG.__faults);
        if (attr == null)
            attr = new DmcTypeWsdlFaultREFMV(DmwsdlDMSAG.__faults);
        
        setLastValue(attr.add(value));
        add(DmwsdlDMSAG.__faults,attr);
        return(attr);
    }

    /**
     * Returns the number of values in faults
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1262)
    public int getFaultsSize(){
        DmcAttribute<?> attr = get(DmwsdlDMSAG.__faults);
        if (attr == null){
            if (DmwsdlDMSAG.__faults.indexSize == 0)
                return(0);
            else
                return(DmwsdlDMSAG.__faults.indexSize);
        }
        return(attr.getMVSize());
    }

    /**
     * Deletes a faults value.
     * @param value The WsdlFault to be deleted from set of attribute values.
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1301)
    public DmcAttribute<?> delFaults(Object value){
        DmcAttribute<?> attr = get(DmwsdlDMSAG.__faults);
        
        if ( (attr == null) && (getModifier()!= null))
            delFromEmptyAttribute(new DmcTypeWsdlFaultREFMV(DmwsdlDMSAG.__faults), value);
        else
            attr = del(DmwsdlDMSAG.__faults, value);
        
        return(attr);
    }

    /**
     * Removes the faults attribute value.
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1355)
    public void remFaults(){
         rem(DmwsdlDMSAG.__faults);
    }

    // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:784)
    public DefinitionName getName(){
        DmcTypeDefinitionNameSV attr = (DmcTypeDefinitionNameSV) get(MetaDMSAG.__name);
        if (attr == null)
            return(null);

        return(attr.getSV());
    }

    /**
     * Sets name to the specified value.
     * @param value DefinitionName
     */
    // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:824)
    public void setName(DefinitionName value) {
        DmcAttribute<?> attr = get(MetaDMSAG.__name);
        if (attr == null)
            attr = new DmcTypeDefinitionNameSV(MetaDMSAG.__name);
        
        try{
            attr.set(value);
            set(MetaDMSAG.__name,attr);
        }
        catch(DmcValueException ex){
            throw(new IllegalStateException("The type specific set() method shouldn't throw exceptions!",ex));
        }
    }

    /**
     * Sets name to the specified value.
     * @param value A value compatible with DmcTypeDefinitionNameSV
     */
    // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:877)
    public void setName(Object value) throws DmcValueException {
        DmcTypeDefinitionNameSV attr  = (DmcTypeDefinitionNameSV) get(MetaDMSAG.__name);
        if (attr == null)
            attr = new DmcTypeDefinitionNameSV(MetaDMSAG.__name);
        
        attr.set(value);
        set(MetaDMSAG.__name,attr);
    }

    /**
     * Removes the name attribute value.
     */
    // org.dmd.dms.util.GenUtility.formatSV(GenUtility.java:897)
    public void remName(){
         rem(MetaDMSAG.__name);
    }

    /**
     * @return An Iterator of WsdlOperationDMO objects.
     */
    @SuppressWarnings("unchecked")
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:970)
    public Iterator<WsdlOperationREF> getOperations(){
        DmcTypeWsdlOperationREFMV attr = (DmcTypeWsdlOperationREFMV) get(DmwsdlDMSAG.__operations);
        if (attr == null)
            return( ((List<WsdlOperationREF>) Collections.EMPTY_LIST).iterator() );

        if (DmcOmni.instance().lazyResolution()){
            if (attr.doLazyResolution(this)){
                rem(attr.getAttributeInfo());
                return( ((List<WsdlOperationREF>) Collections.EMPTY_LIST).iterator() );
            }
        }

        return(attr.getMV());
    }

    /**
     * @return An Iterator of WsdlOperationREFs without attempting lazy resolution (if it's turned on).
     */
    @SuppressWarnings("unchecked")
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:990)
    public Iterator<WsdlOperationREF> getOperationsREFs(){
        DmcTypeWsdlOperationREFMV attr = (DmcTypeWsdlOperationREFMV) get(DmwsdlDMSAG.__operations);
        if (attr == null)
            return( ((List<WsdlOperationREF>) Collections.EMPTY_LIST).iterator() );

        return(attr.getMV());
    }

    /**
     * Adds another operations to the specified value.
     * @param value WsdlOperation
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1004)
    public DmcAttribute<?> addOperations(WsdlOperationDMO value) {
        DmcAttribute<?> attr = get(DmwsdlDMSAG.__operations);
        if (attr == null)
            attr = new DmcTypeWsdlOperationREFMV(DmwsdlDMSAG.__operations);
        
        try{
            setLastValue(attr.add(value));
            add(DmwsdlDMSAG.__operations,attr);
        }
        catch(DmcValueException ex){
            throw(new IllegalStateException("The type specific add() method shouldn't throw exceptions!",ex));
        }
        return(attr);
    }

    /**
     * Adds another operations value.
     * @param value A value compatible with WsdlOperation
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1245)
    public DmcAttribute<?> addOperations(Object value) throws DmcValueException {
        DmcAttribute<?> attr = get(DmwsdlDMSAG.__operations);
        if (attr == null)
            attr = new DmcTypeWsdlOperationREFMV(DmwsdlDMSAG.__operations);
        
        setLastValue(attr.add(value));
        add(DmwsdlDMSAG.__operations,attr);
        return(attr);
    }

    /**
     * Returns the number of values in operations
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1262)
    public int getOperationsSize(){
        DmcAttribute<?> attr = get(DmwsdlDMSAG.__operations);
        if (attr == null){
            if (DmwsdlDMSAG.__operations.indexSize == 0)
                return(0);
            else
                return(DmwsdlDMSAG.__operations.indexSize);
        }
        return(attr.getMVSize());
    }

    /**
     * Deletes a operations value.
     * @param value The WsdlOperation to be deleted from set of attribute values.
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1301)
    public DmcAttribute<?> delOperations(Object value){
        DmcAttribute<?> attr = get(DmwsdlDMSAG.__operations);
        
        if ( (attr == null) && (getModifier()!= null))
            delFromEmptyAttribute(new DmcTypeWsdlOperationREFMV(DmwsdlDMSAG.__operations), value);
        else
            attr = del(DmwsdlDMSAG.__operations, value);
        
        return(attr);
    }

    /**
     * Removes the operations attribute value.
     */
    // org.dmd.dms.util.GenUtility.formatMV(GenUtility.java:1355)
    public void remOperations(){
         rem(DmwsdlDMSAG.__operations);
    }




}
